if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
_gdk_frame_clock_debug_print_timings (clock, timings);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
#endif
}
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
#ifdef G_ENABLE_DEBUG
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_set_int_counter (pixels_counter,
g_get_monotonic_time (),
region_get_pixels (priv->frame_region));
g_signal_emit (frame_clock, signals[FLUSH_EVENTS], 0);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "frameclock", "flush-events");
g_signal_emit (frame_clock, signals[BEFORE_PAINT], 0);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "frameclock", "before-paint");
g_signal_emit (frame_clock, signals[UPDATE], 0);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "frameclock", "update");
g_signal_emit (frame_clock, signals[LAYOUT], 0);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "frameclock", "layout");
g_signal_emit (frame_clock, signals[PAINT], 0);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "frameclock", "paint");
g_signal_emit (frame_clock, signals[AFTER_PAINT], 0);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "frameclock", "after-paint");
g_signal_emit (frame_clock, signals[RESUME_EVENTS], 0);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "frameclock", "resume-events");
if (priv->freeze_count == 0)
priv->sleep_serial = get_sleep_serial ();
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (before, (g_get_monotonic_time () - before), "frameclock", "paint_idle");
return FALSE;
if (priv->freeze_count == 0)
{
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
priv->freeze_time = g_get_monotonic_time ();
}
priv->sleep_serial = get_sleep_serial ();
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
if (priv->freeze_time != 0)
{
G_BEGIN_DECLS
+/* Ensure we included config.h as needed for the below HAVE_SYSPROF_CAPTURE check */
+#ifndef GETTEXT_PACKAGE
+#error "config.h was not included before gdkprofilerprivate.h."
+#endif
+
+/* We make this a macro you use as if (GDK_PROFILER_IS_RUNNING) because that
+ * way we can ensure all the code is compiled out when not supported, and
+ * we can add a G_UNLIKELY() for better codegen if it is.
+ */
+#ifdef HAVE_SYSPROF_CAPTURE
+#define GDK_PROFILER_IS_RUNNING G_UNLIKELY (gdk_profiler_is_running ())
+#else
+#define GDK_PROFILER_IS_RUNNING FALSE
+#endif
+
void gdk_profiler_start (int fd);
void gdk_profiler_stop (void);
gboolean gdk_profiler_is_running (void);
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
}
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
add_event_mark (event, begin_time, g_get_monotonic_time () - begin_time);
return handled;
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
g_value_unset (&v);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gdk_profiler_add_mark (before, (g_get_monotonic_time () - before), "wayland", "load cursor theme");
}
_gdk_frame_clock_debug_print_timings (clock, timings);
#endif
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
}
if (GDK_DISPLAY_DEBUG_CHECK (display, FRAMES))
_gdk_frame_clock_debug_print_timings (clock, timings);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
#endif /* G_ENABLE_DEBUG */
}
self->icon_cache = get_icon_cache_for_display (gdk_surface_get_display (surface), self->atlases);
gsk_gl_shadow_cache_init (&self->shadow_cache);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (before, (g_get_monotonic_time () - before), "gl renderer realize", NULL);
return TRUE;
gsk_profiler_push_samples (profiler);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (start_time, cpu_time, "GL render", "");
#endif
gsk_profiler_push_samples (profiler);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gdk_profiler_add_mark (start_time, cpu_time, "render", "");
gdk_profiler_set_int_counter (texture_pixels_counter,
before2 = g_get_monotonic_time ();
gtk_init ();
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (before2, (g_get_monotonic_time () - before2), "gtk init", NULL);
priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
gtk_application_load_resources (application);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (before, (g_get_monotonic_time () - before), "gtk application startup", NULL);
}
int fd = -1;
int idx;
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
}
else if (strcmp (method_name, "Stop") == 0)
{
- if (!gdk_profiler_is_running ())
+ if (!GDK_PROFILER_IS_RUNNING)
{
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
gtk_css_node_validate_internal (cssnode, &filter, timestamp);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "css validation", "");
}
#endif
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (before, (g_get_monotonic_time () - before), "create selector tree", NULL);
}
g_bytes_unref (bytes);
}
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
char *uri = g_file_get_uri (file);
gdk_profiler_add_mark (before, (g_get_monotonic_time () - before), "theme load", uri);
now = g_get_monotonic_time ();
if (now > start + 8000)
{
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (start, (now - start), "emojichooser", "populate");
return G_SOURCE_CONTINUE;
}
chooser->box = NULL;
chooser->populate_idle = 0;
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
now = g_get_monotonic_time ();
gdk_profiler_add_mark (start, (now - start), "emojichooser", "populate (finish)");
load_themes (self);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_mark (before, (g_get_monotonic_time () - before), "icon theme load", self->current_theme);
if (was_valid)
g_assert (icon->texture != NULL);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
gdk_profiler_add_markf (before, g_get_monotonic_time () - before, in_thread ? "icon load (thread)" : "icon load" ,
"%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
}
gtk_widget_snapshot (widget, snapshot);
root = gtk_snapshot_free_to_node (snapshot);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "widget snapshot", "");
gsk_render_node_unref (root);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
before = after;
after = g_get_monotonic_time ();
else if (gtk_widget_get_visible (widget))
gtk_window_move_resize (self);
- if (gdk_profiler_is_running ())
+ if (GDK_PROFILER_IS_RUNNING)
{
gint64 after = g_get_monotonic_time ();
gdk_profiler_add_mark (before, (after - before), "size allocation", "");